<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>B馆电动车－汽车生活馆</title>
<link  rel="stylesheet" href="{$_C.hy_path}css/car/getthepage.css" />
</head>

<body>
<div class="logo"><img src="{$_C.hy_path}images/car/logo.png" /></div>
<div class="shan">
	<div class="ma">赞助商:{$prize_user.support}</div>
    <div class="shu">2015.11.20</div>
</div>
<div class="lp">
	<div class="lpzi"><span>{$prize_user.money}元</span>{$prize_user.prize_name}</div>
</div>
{if $prize_user.is_card == 0}
<div class="btn1" onclick="try_card()"  ><img src="{$_C.hy_path}images/car/linqu.png" /></div>
{else}
<div class="btn1"   ><img src="{$_C.hy_path}images/car/linqu2.png" /></div>
{/if}
</body>

<script src="{$_C.hy_path}/js/zepto.min.js"></script>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	
<script>
		   
		   
		  var prize_user_id = '{$prize_user.id}' 
		   
		  wx.config({
		    debug: false, 
		   appId: '{$jsdk.appId}',
				timestamp: {$jsdk.timestamp},
				nonceStr: '{$jsdk.nonceStr}',
				signature: '{$jsdk.signature}',
		    jsApiList: [
		      // 所有要调用的 API 都要加到这个列表中
			  'hideAllNonBaseMenuItem',
	    
		      'addCard',
			 
		     
		    ]
		  });
		
		  
		  wx.ready(function () {
			  wx.hideAllNonBaseMenuItem();
			
		  });
	
		  
		  function try_card()
		  {
			
			  var url = "index.php?g=mobile&m=car&a=ajaxCard";

			  var data = {
					  id:prize_user_id
			  };
			 
				$.post(url,data,function(cardlist){
					 wx.addCard({
			              cardList: cardlist,
			              success: function (res) {
			            	  get_card(prize_user_id);  
			              }
			            });
					 
					 
				},"json");
          	  
            	
		  }
		  
		  
		  //领取卡券后异步回调
		  function get_card(id)
		  {
				  
			  var url = "index.php?g=mobile&m=car&a=getCard";
				
			  var data = {
					  id:id
			  }
				$.post(url,data,function(res){
					//showMsg("领取成功。");
					
					window.location.href="index.php?g=mobile&m=car&a=shake";
					//document.getElementById('mcover').style.display='block';
					
				},"text");
          	  
            
		  }
		 
			 
		
		</script>
		
</html>
